package com.yhgarden.bbs.controller.business;

import com.yhgarden.bbs.entity.business.UserGroup;
import com.yhgarden.bbs.model.response.BaseResponse;
import com.yhgarden.bbs.service.api.business.UserGroupService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import java.util.List;

/**
* @author Laijiaxiang
* @since 2019-09-23
*/
@Controller("adminUserGroupController")
@RequestMapping(value = {"/admin/userGroup","*/admin/userGroup"})
public class UserGroupController {

    @Autowired
    private UserGroupService userGroupService;

    @RequestMapping(value = "/createOrUpdate", method = RequestMethod.POST,
                    consumes = {"application/json"},
                    produces = {"application/json"})
    @ResponseBody
    public BaseResponse createOrUpdate(@RequestBody UserGroup userGroup) {
        BaseResponse res = userGroupService.createOrUpdate(userGroup);
        return res;
    }

    @RequestMapping(value = "/getById/{id}", method = RequestMethod.GET)
    @ResponseBody
    public BaseResponse getById(@PathVariable("id") String id) {
        BaseResponse res = userGroupService.getById(id);
        return res;
    }

    @RequestMapping(value = "/getByIdForList/{id}", method = RequestMethod.GET)
    @ResponseBody
    public BaseResponse getByIdForList(@PathVariable("id") String id) {
        BaseResponse res = userGroupService.getByIdForList(id);
        return res;
    }

    @RequestMapping(value = "/getByIdMoreDetail/{id}", method = RequestMethod.GET)
    @ResponseBody
    public BaseResponse getByIdMoreDetail(@PathVariable("id") String id) {
        BaseResponse res = userGroupService.getByIdMoreDetail(id);
        return res;
    }

    @RequestMapping(value = "/query", method = RequestMethod.POST,
            consumes = {"application/json"},
            produces = {"application/json"})
    @ResponseBody
    public BaseResponse query(@RequestBody UserGroup userGroup) {
        BaseResponse res = userGroupService.query(userGroup);
        return res;
    }

    @RequestMapping(value = "/queryForList", method = RequestMethod.POST,
                    consumes = {"application/json"},
                    produces = {"application/json"})
    @ResponseBody
    public BaseResponse queryForList(@RequestBody UserGroup userGroup) {
        BaseResponse res = userGroupService.queryForList(userGroup);
        return res;
    }

    @RequestMapping(value = "/queryMoreDetail", method = RequestMethod.POST,
                    consumes = {"application/json"},
                    produces = {"application/json"})
    @ResponseBody
    public BaseResponse queryMoreDetail(@RequestBody UserGroup userGroup) {
        BaseResponse res = userGroupService.queryMoreDetail(userGroup);
        return res;
    }

    @RequestMapping(value = "/delete/{id}", method = RequestMethod.POST)
    @ResponseBody
    public BaseResponse delete(@PathVariable("id") String id) {
        BaseResponse res = userGroupService.delete(id);
        return res;
    }

}

